////#include<iostream>
////#include<unordered_map>
////using namespace std;
////const int N = 1e6 + 10;
////int a[N];
////int main()
////{
////	int n, m;cin >> n >> m;
////	for (int i = 1; i <= n; i++)
////	{
////		cin >> a[i];
////	}int sum = 1e7;int ret = 0, ans = 0;
////	for (int i = 1; i <= n; i++)
////	{
////		unordered_map<int, int > mp;
////		int left = i, right = left;
////		while (right <= n || mp.size() != m)
////		{
////			mp[right++]++;
////			sum++;
////		}
////		if (right - left + 1 > sum)
////		{
////			ret = left;
////			ans = right;
////		}
////	}
////	cout << ret << " " << ans;
////	return 0;
////}
//#include<iostream>
//#include<unordered_map>
//const int N = 1e6 + 10;
//int a[N];
//using namespace std;
//int main()
//{
//	int n, m;cin >> n >> m;
//	for (int i = 1; i <= n; i++)
//	{
//		cin >> a[i];
//	}
//	int left = 1, right = 1, kind = 0, len = 0,ret = n,begin = 1;
//	unordered_map<int, int>mp;
//	while(right <= n)
//	{
//		if (mp[a[right]]++ == 0) kind++;
//		while (kind == m)
//		{
//			len = right - left + 1;
//			if (len < ret)
//			{
//				ret = len;
//				begin = left;
//			}
//			if (mp[a[left]]-- == 1) kind--;
//			left++;
//		}
//		right++;
//	}
//	cout << begin << " " << begin + len - 1 << endl;
//	return 0;
//}
#include<iostream>
#include<unordered_map>
const int N = 1e6 + 10;
int a[N];
int n, m,kind;
using namespace std;
int main()
{
	unordered_map<int, int> mp;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	int left = 1, right = 1, ret = n,begin = 1;
	while (right <= n)
	{
		if (mp[a[right]]++ == 0) kind++;
		while (kind == m)
		{
			int len = right - left + 1;
			if (len < ret)
			{
				begin = left;
				ret = len;
			}
			if (mp[a[left]]-- == 1) kind--;
			left++;
		}
		right++;
	}
	cout << begin << " " << begin + ret - 1;
	return 0;
}